package com.rockcent.mall.lib.domain;

import com.rockcent.common.domain.IDEntityMall;
import com.rockcent.mall.lib.domain.enumclass.OrderSource;
import com.rockcent.mall.lib.domain.enumclass.PaymentMethod;
import com.rockcent.mall.lib.domain.enumclass.MallOrderPaymentStatus;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.math.BigDecimal;

/**
 * 平台订单支付流水
 */
@Table(name = "mall_order_payment_flow")
@Entity
@DynamicUpdate
@DynamicInsert
public class MallOrderPaymentFlow extends IDEntityMall {

    @Column(columnDefinition = "varchar(50) comment '支付流水号'")
    private String flowNum;
    @Column(columnDefinition = "varchar(50) comment '支付号'")
    private String paymentNum;
    @Column(columnDefinition = "bigint comment '客户 id'")
    private Long customerId;
    @Column(columnDefinition = "varchar(30) comment '支付方式'")
    @Enumerated(EnumType.STRING)
    private PaymentMethod paymentMethod;
    @Column(columnDefinition = "bigint comment '平台 id'")
    private Long mallId;
    @Column(columnDefinition = "varchar(200) comment '平台订单号'")
    private String mallOrderNum;
    @Column(columnDefinition = "bigint comment '平台订单id'")
    private Long mallOrderId;
    @Column(columnDefinition = "DECIMAL(30,10) comment '金额'")
    private BigDecimal amount;
    @Column(columnDefinition = "varchar(30) comment '支付状态'")
    @Enumerated(EnumType.STRING)
    private MallOrderPaymentStatus status = MallOrderPaymentStatus.WAIT;

    @Column(columnDefinition = "varchar(200) comment '平台订单号'")
    private String prepayId;

    /**
     * 订单来源，WXAPP:微信小程序；WEXIN:公众号H5
     */
    @Column(columnDefinition = "varchar(100) comment '订单来源，WXAPP:微信小程序；WECHAT:公众号H5'")
    @Enumerated(EnumType.STRING)
    private OrderSource orderSource;

    public Long getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }

    public PaymentMethod getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(PaymentMethod paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    public Long getMallId() {
        return mallId;
    }

    public void setMallId(Long mallId) {
        this.mallId = mallId;
    }

    public String getMallOrderNum() {
        return mallOrderNum;
    }

    public void setMallOrderNum(String mallOrderNum) {
        this.mallOrderNum = mallOrderNum;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Long getMallOrderId() {
        return mallOrderId;
    }

    public void setMallOrderId(Long mallOrderId) {
        this.mallOrderId = mallOrderId;
    }

    public MallOrderPaymentStatus getStatus() {
        return status;
    }

    public void setStatus(MallOrderPaymentStatus status) {
        this.status = status;
    }

    public String getPaymentNum() {
        return paymentNum;
    }

    public void setPaymentNum(String paymentNum) {
        this.paymentNum = paymentNum;
    }

    public String getFlowNum() {
        return flowNum;
    }

    public void setFlowNum(String flowNum) {
        this.flowNum = flowNum;
    }

    public String getPrepayId() {
        return prepayId;
    }

    public void setPrepayId(String prepayId) {
        this.prepayId = prepayId;
    }

    public OrderSource getOrderSource() {
        return orderSource;
    }

    public void setOrderSource(OrderSource orderSource) {
        this.orderSource = orderSource;
    }

    @Override
    public String toString() {
        return "MallOrderPaymentFlow{" +
                "id=" + id +
                ",flowNum='" + flowNum + '\'' +
                ", paymentNum='" + paymentNum + '\'' +
                ", customerId=" + customerId +
                ", paymentMethod=" + paymentMethod +
                ", mallId=" + mallId +
                ", mallOrderNum='" + mallOrderNum + '\'' +
                ", mallOrderId=" + mallOrderId +
                ", amount=" + amount +
                ", status=" + status +
                ", prepayId='" + prepayId + '\'' +
                ", orderSource=" + orderSource +
                ", dateCreated=" + dateCreated +
                ", lastUpdated=" + lastUpdated +
                ", isDelete=" + isDelete +
                ", version=" + version +
                '}';
    }
}